import { createRouter, createWebHashHistory } from 'vue-router'

import HomeView from "../views/HomeView.vue";
import BookshelfView from "../views/BookshelfView.vue";
import ShopView from "../views/ShopView.vue";
import CategoryView from "../views/CategoryView.vue";
import MyView from "../views/MyView.vue";
import CherryPickView from "../views/CherryPickView.vue";
import FreeView from "../views/FreeView.vue";
import ManView from "../views/ManView.vue";
import WomenView from "../views/WomenView.vue";
import PublishView from "../views/PublishView.vue";
import ListenView from "../views/ListenView.vue";
import ShortCut from "../views/ShortCut.vue";
import BookDetail from "../views/BookDetail.vue";
import ChapterList from "../views/ChapterList.vue";
import BookContent from "../views/BookContent.vue";
import AllComment from "../views/AllComment.vue";
import ComeOutNavPage from "../views/ComeOutNavPage.vue";
import PublishBookDetail from "../views/PublishBookDetail.vue";
import BookListenPage from "../views/BookListenPage.vue";
import SearchPage from "../views/SearchPage.vue";
import SearchResultShow from "../views/SearchResultShow.vue";
import LoginPage from "../views/LoginPage.vue";
import UserInfoPage from "../views/UserInfoPage.vue";
import ChapterBuyPage from "../views/ChapterBuyPage.vue";
import BuyOrUpload from "../views/BuyOrUpload.vue";
import BookBuyDetail from "../views/BookBuyDetail.vue";
import { nextTick } from 'vue';



// const store = useCounterStore()
const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      redirect: 'shop',
      children: [
        {
          path: 'bookshelf',
          name: 'bookshelf',
          component: BookshelfView,
        },
        {
          path: 'shop',
          name: 'shop',
          component: ShopView,
          redirect: 'shop/cherry-pick',
          children: [
            {
              path: 'cherry-pick',
              name: 'cherryPick',
              component: CherryPickView,
            },
            {
              path: 'free',
              name: 'free',
              component: FreeView,
            },
            {
              path: 'man',
              name: 'man',
              component: ManView,
            },
            {
              path: 'women',
              name: 'women',
              component: WomenView,
            },
            {
              path: 'public',
              name: 'public',
              component: PublishView,
            },
            {
              path: 'listen',
              name: 'listen',
              component: ListenView,
            }
          ]
        },
        {
          path: 'category',
          name: 'category',
          component: CategoryView,
        },
        {
          path: 'my',
          name: 'my',
          component: MyView,
        }
      ]
    },
    {
      path: '/ShortCut',
      name: 'ShortCut',
      component: ShortCut
    },
    {
      path: '/detail',
      name: 'bookDetail',
      component: BookDetail
    },
    {
      path: '/chapter',
      name: 'chapter',
      component: ChapterList
    },
    {
      path: '/content',
      name: 'book-content',
      component: BookContent
    },
    {
      path: '/all-comment',
      name: 'all-comment',
      component: AllComment
    },
    {
      path: '/publish-nav',
      name: 'publish-nav',
      component: ComeOutNavPage
    },
    {
      path: '/publish-detail',
      name: 'publish-detail',
      component: PublishBookDetail
    },
    {
      path: '/book-listen',
      name: 'book-listen',
      component: BookListenPage
    },
    {
      path: '/search',
      name: 'search',
      component: SearchPage
    },
    {
      path: '/search-show',
      name: 'search-show',
      component: SearchResultShow
    },
    {
      path: '/login',
      name: 'LoginPage',
      component: LoginPage,
    },
    {
      path: '/userInfo',
      name: 'userInfo',
      component: UserInfoPage,
    },
    {
      path: '/buy',
      name: 'chapterBuyPage',
      component: ChapterBuyPage,
    },
    {
      path: '/buy-upload',
      name: 'buyOrUpload',
      component: BuyOrUpload,
    },
    {
      path: '/buy-detail',
      name: 'bookBuyDetail',
      component: BookBuyDetail,
    },

  ],

})


export default router
